JavaScript
import Runloop from '@runloop/api-client';
const client = new Runloop({
bearerToken: process.env['RUNLOOP_API_KEY'], // This is the default and can be omitted
});
const axonEventView = await client.axons.subscribeSse('id');
console.log(axonEventView.axon_id);import os
from runloop_api_client import Runloop
client = Runloop(
bearer_token=os.environ.get("RUNLOOP_API_KEY"), # This is the default and can be omitted
)
for axon in client.axons.subscribe_sse(
id="id",
):
print(axon)curl --request GET \
--url https://api.runloop.ai/v1/axons/{id}/subscribe/sse \
--header 'Authorization: Bearer <token>'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.runloop.ai/v1/axons/{id}/subscribe/sse",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.runloop.ai/v1/axons/{id}/subscribe/sse"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.runloop.ai/v1/axons/{id}/subscribe/sse")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.runloop.ai/v1/axons/{id}/subscribe/sse")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"sequence": 123,
"axon_id": "<string>",
"timestamp_ms": 123,
"origin": "EXTERNAL_EVENT",
"source": "<string>",
"event_type": "<string>",
"payload": "<string>"
}axons
[Beta] Subscribe to an axon event stream via SSE.
[Beta] Subscribe to an axon event stream via server-sent events.
GET
/
v1
/
axons
/
{id}
/
subscribe
/
sse
JavaScript
import Runloop from '@runloop/api-client';
const client = new Runloop({
bearerToken: process.env['RUNLOOP_API_KEY'], // This is the default and can be omitted
});
const axonEventView = await client.axons.subscribeSse('id');
console.log(axonEventView.axon_id);import os
from runloop_api_client import Runloop
client = Runloop(
bearer_token=os.environ.get("RUNLOOP_API_KEY"), # This is the default and can be omitted
)
for axon in client.axons.subscribe_sse(
id="id",
):
print(axon)curl --request GET \
--url https://api.runloop.ai/v1/axons/{id}/subscribe/sse \
--header 'Authorization: Bearer <token>'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.runloop.ai/v1/axons/{id}/subscribe/sse",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.runloop.ai/v1/axons/{id}/subscribe/sse"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.runloop.ai/v1/axons/{id}/subscribe/sse")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.runloop.ai/v1/axons/{id}/subscribe/sse")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"sequence": 123,
"axon_id": "<string>",
"timestamp_ms": 123,
"origin": "EXTERNAL_EVENT",
"source": "<string>",
"event_type": "<string>",
"payload": "<string>"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
The axon identifier.
Query Parameters
Sequence number after which to start streaming. Events with sequence > this value are returned. If unset, replay from the beginning.
Response
200 - application/json
OK
Monotonic sequence number.
The axon identifier.
Timestamp in milliseconds since epoch.
Event origin.
Available options:
EXTERNAL_EVENT, AGENT_EVENT, USER_EVENT, SYSTEM_EVENT Event source (e.g. github, slack).
Event type (e.g. push, pull_request).
JSON-encoded event payload.
Was this page helpful?
